import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    //点击消除
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s = in.next().toCharArray();
        StringBuilder st = new StringBuilder();

        for (int i = 0; i < s.length; i++) {
            char ch = s[i];
            if (st.length()!=0 && ch==st.charAt(st.length()-1)){
                st.deleteCharAt(st.length()-1);
            }else{
                st.append(ch);
            }
        }
        System.out.println(st.length()==0 ? 0 : st.toString());
    }


    //两个数组的交集
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        boolean[] hash = new boolean[1010];
        ArrayList<Integer> ret = new ArrayList<>();

        for (int x: nums1) {
            hash[x] = true;
        }
        for (int x:nums2) {
            if (hash[x]){
                ret.add(x);
                hash[x] = false;
            }
        }
        return ret;
    }


    //数字统计
    public static void main1(String[] args) {
        Scanner s = new Scanner(System.in);
        int l = s.nextInt(), r= s.nextInt();

        int ret = 0;
        for(int i = l; i <= r; i++){
            int tmp = i;
            while(tmp != 0){
                if(tmp%10 == 2) ret++;
                tmp/=10;
            }
        }
        System.out.println(ret);
    }
}